/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2014年12月27日         Root.Lu
 */

package com.coocaa.launcher.statusplugins.calendar;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.coocaa.launcher.framework.launcherhost.statusbar.StatusBarPluginView;
import com.coocaa.launcher.statusplugins.calendar.StatusPluginCalendar.IStatusPluginCalendarView;

public class StatusPluginCalendarView extends StatusBarPluginView implements
        IStatusPluginCalendarView {
    private TextView textView = null;

    public StatusPluginCalendarView(Context context, String name) {
        super(context, name);
        textView = new TextView(context);
        textView.setTextColor(Color.WHITE);
        textView.setTextSize(Dpi(32));
        //textView.setTextAppearance(context, R.style.statusbar_plugin_text_style);
        addView(textView);
    }

    @Override
    public int getConfigGravity() {
        // TODO Auto-generated method stub
        return Gravity.RIGHT;
    }

    @Override
    public void updateString(final String string, final boolean isVisible) {
        // TODO Auto-generated method stub
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // TODO Auto-generated method stub
                textView.setText(string);
                if(isVisible){
                    textView.setVisibility(View.VISIBLE);
                }else{
                    textView.setVisibility(View.INVISIBLE);
                }
            }
        });
    }
}
